home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 131 / XENIATGM131.iso / Shareware / openOffice.org 641 / Windows / f_0047 / sbasic.jar / text / sbasic / common / 03090302.xml < prev    next >
Extensible Markup Language  |  2001-09-07  |  5KB  |  84 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>GoTo Statement [Runtime]</title><meta name="filename" content="text/sbasic/common/03090302"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         table.Tabelle1{
  5.                 }
  6.         span.Tabelle1A{
  7.                 width:1.499cm;}
  8.         span.Tabelle1B{
  9.                 width:16.498cm;}
  10.         tr.Tabelle11{
  11.                 }
  12.         td.Tabelle1A1{
  13.                 }
  14.         table.Tabelle2{
  15.                 }
  16.         span.Tabelle2A{
  17.                 width:1.499cm;}
  18.         span.Tabelle2B{
  19.                 width:16.498cm;}
  20.         tr.Tabelle21{
  21.                 }
  22.         td.Tabelle2A1{
  23.                 }
  24.         p.P1{
  25.                 }
  26.         span.T1{
  27.                 font-weight:bold;}
  28.         span.fr1{
  29.                 }
  30.         </style></head><body>
  31.   
  32.   
  33.   <help:to-be-embedded Eid="goto" xmlns:help="http://openoffice.org/2000/help"><a name="goto"/>
  34.   <p class="Head1"><help:link Id="66534">GoTo Statement [Runtime]</help:link></p>
  35.   <p class="Paragraph">Continues program execution within a Sub or Function at the procedure line indicated by a label.</p>
  36.   </help:to-be-embedded>
  37.   <p class="Paragraph"><span class="T1">Syntax</span>:</p>
  38.   <p class="Paragraph">see Parameter see</p>
  39.   <p class="Paragraph"><span class="T1">Parameter</span>:</p>
  40.   <p class="Paragraph">Sub/Function</p>
  41.   <p class="Paragraph">statement block</p>
  42.   <p class="Paragraph"><help:key-word value="GoTo" tag="kw66534_1" xmlns:help="http://openoffice.org/2000/help"/>GoTo Label1</p>
  43.   <p class="Paragraph"><span class="T1">Label2:</span></p>
  44.   <p class="Paragraph">statement block</p>
  45.   <p class="Paragraph">Exit Sub</p>
  46.   <p class="Paragraph"><span class="T1">Label1:</span></p>
  47.   <p class="Paragraph">statement block</p>
  48.   <p class="Paragraph">GoTo Label2</p>
  49.   <p class="Paragraph">End Sub/Function</p>
  50.   <p class="Paragraph">Use the <span class="T1">GoTo</span> statement to instruct OpenOffice.org Basic to continue program execution at another place within the procedure. The position must be indicated by a label. To set a label, assign a name and end it with a colon (":").</p>
  51.   <table><tr class="Tabelle11"><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1A">
  52.       <p class="TextInTable"><draw:image draw:style-name="fr1" draw:name="HIND_1" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="0" xlink:href="65640" xlink:type="simple" xlink:show="embed" xlink:actuate="onRequest" draw:filter-name="GIF - Graphics Interchange" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>
  53.       </p>
  54.      </span></th><th class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1B">
  55.       <p class="TextInTable">You cannot use the GoTo statement to jump out of a Sub or Function.</p>
  56.      </span></th></tr></table>
  57.   <p class="Paragraph"/>
  58.   <table><tr class="Tabelle21"><th class="Tabelle2A1" style="text-align:left;"><span class="Tabelle2A">
  59.       <p class="TextInTable"><draw:image draw:style-name="fr1" draw:name="HIND_2" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="1" xlink:href="66732" xlink:type="simple" xlink:show="embed" xlink:actuate="onRequest" draw:filter-name="GIF - Graphics Interchange" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>
  60.       </p>
  61.      </span></th><th class="Tabelle2A1" style="text-align:left;"><span class="Tabelle2B">
  62.       <p class="TextInTable"><span class="T1">GoTo</span> is a relict of BASIC dialects which is retained only for compatibility reasons. If you often use GoTo, your program will tend to become unreadable. For this reason, it is preferable to use Sub procedures, with exception of <span class="T1">On...GoTo</span> and <span class="T1">On Error GoTo</span>.</p>
  63.      </span></th></tr></table>
  64.   <p class="Paragraph"/>
  65.   <p class="Paragraph"><span class="T1">Example:</span></p>
  66.   <p class="PropText">Sub ExampleOnGosub</p>
  67.   <p class="PropText">Dim iVar As Integer</p>
  68.   <p class="PropText">Dim sVar As String</p>
  69.   <p class="PropText">iVar = 2</p>
  70.   <p class="PropText">sVar =""</p>
  71.   <p class="PropText">On iVar GoSub Sub1, Sub2</p>
  72.   <p class="PropText">On iVar GoTo Line1, Line2</p>
  73.   <p class="PropText">Exit Sub</p>
  74.   <p class="PropText">Sub1:</p>
  75.   <p class="PropText">sVar =sVar & " From Sub 1 to" : Return</p>
  76.   <p class="PropText">Sub2:</p>
  77.   <p class="PropText">sVar =sVar & " From Sub 2 to" : Return</p>
  78.   <p class="PropText">Line1:</p>
  79.   <p class="PropText">sVar =sVar & " Label 1"</p>
  80.   <p class="PropText">Line2:</p>
  81.   <p class="PropText">sVar =sVar & " Label 2"</p>
  82.   <p class="PropText">Print sVar</p>
  83.   <p class="PropText">End Sub</p>
  84.  </body></html>